local ingarage = false
local clvehicle = nil
local clangles = Angle(0,180,0)

hook.Add("CalcView", "LookAt", function( ply, origin, angles, fov )
	if !ingarage then return end

	local view = {}

	local create = ents.FindByClass("vehicle_creation_point")[1]

	if !create then return end

	view.angles = ((create:GetPos() + Vector(0,0,32)) - origin):Angle() 

	return view
end)

function GM:ShowGarage(show)
	ingarage = show

	if show then
		clvehicle = ClientsideModel("models/buggy.mdl")
		clvehicle:SetNoDraw(true)

		gui.EnableScreenClicker(true)
	else
		if clvehicle then
			clvehicle:Remove()
			clvehicle = nil
		end

		gui.EnableScreenClicker(false)
	end
end

function GM:DrawVehicle(ent)
	if !ingarage || !clvehicle then return end

	clangles.y = clangles.y + FrameTime() * 20

	clvehicle:SetPos(ent:GetPos())
	clvehicle:SetAngles(clangles)

	clvehicle:DrawModel()
end